xquery version "1.0-ml";
module namespace config="http://jqstore.org/config";
import module namespace jqstore="http://jqstore.org/jqstore" at "jqstore.xqy";

declare option xdmp:mapping "false";

(: This determines which database will be used. Leaving it empty causes the current database to be used. :)
declare variable $dbName := ();

(: Requests starting with this path will be considered calls to jqstore database :)
declare variable $path := '/jqstore';

(: Where data will be stored within the database :)
declare variable $datapath := '/content/jqstore';

(:
	Example queries:
	{
		"user":"/user[id='" + + "']",
		
			.set('user','/user[id='someid']")
			.set('items','/items[userid = $user/itemsid]")
	}
	user=/user[id = 'someid']
	users-items=/user[id = 'someid']/item
	first-tag=/user/tag[0]
	user=/user/tag[-1] last one
	user=/user[id='someid']{items=/item[userid=@user/id]{item-cost=/costs[id=@items]/amount}};doc-urls=/doc[userid=@user/id]/url
	
	Put members into array (surround with object)
	Put object into array (automatic)
	Put array into object (needs a name?)

:)